<link rel="stylesheet" type="text/css" href="<?= base_url() ?>file/js/easyui/themes/gray/easyui.css">
<link rel="stylesheet" type="text/css" href="<?= base_url() ?>file/js/easyui/themes/icon.css">

<script type="text/javascript" src="<?= base_url() ?>file/js/easyui/jquery.easyui.min.js"></script>


<div class="box">
  
   <!-- box / title -->
  <div class="title">
      <h5>Nota Penjualan Barang</h5>
  </div>

  <div class="table">

    <div class="panel-wrap" style="height: auto">

      <div class="panel-header-div">Informasi Teritori</div>
      <div class="panel-body-div">
        <div class="left-panel-body">
          <h2><?php echo $sell["header"]->territory_name; ?></h2>
        </div>
        
        <div class="right-panel-body">
          <table class="table-right-panel" width="100%" border="solid black 1px">
            <tr align="center" class="tr-colour">
              <th width="50%" align="center">Tanggal</th>
              <th align="center">No Pengambilan Barang</th>
            </tr>
            <tr align="center" class="gray">
              <td width="50%" align="center" style="font-size: 1.3em;">
                <?php echo date("d F Y", strtotime($sell["header"]->sell_in_date)); ?>
              </td>                    
              <td class="readonly" align="center" >
                <span style="font-size: 16pt"><b><?php echo $sell["header"]->sell_in_id; ?></b></span>
              </td>
              
            </tr>
          </table>
        
        </div>
        
      </div>
    </div>

    <div class="panel-wrap" style="height: auto">
      <div class="panel-header-div">Informasi Pengambilan Barang</div>
      <div class="panel-body-div">

        <table class="trans-info" style="margin: 10px; border: solid 1px #bbbbbb; font-size: 12px; width: 500px">
          <thead>
            <tr>
              <td style="background: #efefef; border-right: solid 1px #cccccc">Nama Sales</td>
              <td><?php echo $sell['header']->user_id.' | '.$sell['header']->user_name; ?></td>
            </tr>
            <tr>
              <td style="background: #efefef; border-right: solid 1px #cccccc">Nama Partner</td>
              <td><?php echo $sell['header']->channel_id.' | '.$sell['header']->channel_name; ?></td>
            </tr>
            <tr>
              <td style="background: #efefef; border-right: solid 1px #cccccc">Program Nasional</td>
              <td>
                <?php echo $sell['program'][0]->caption; ?>
              </td>
            </tr>
            <tr>
              <td style="background: #efefef; border-right: solid 1px #cccccc">Program Cluster</td>
              <td>
                <?php 
                  if(isset($sell['program'][1])) { echo $sell['program'][1]->caption; }
                  else { echo '-'; }
                ?>
              </td>
            </tr>
          </thead>
        </table>
      

        <div class="child-panel-body">  
          <!-- <table id="table-updateable" class="table-right-panel" width="92%" style="margin-left: 19px;"> -->
          <table id="table-updateable" class="item-list">
            <thead>
              <tr align="center" class="tr-colour3">
                <th style="width:3%">No.</th>
                <th>ICCID</th>
                <th>MDN</th>
                <th>Keterangan</th>
                <th>Grup Item</th>
                <th>Harga (Rp.)</th>
              </tr>
            </thead>
            <tbody>
            <?php
            
              $subtotal = 0;
              $price = 0;
              $x=1;
              foreach ($sell["detail"] as $item) {
              ?>
              <tr class="wide scan_in_details">
                <td><?=$x?></td>
                <td><?=$item->iccid?></td>
                <td><?=$item->mdn?></td>
                <td><?=$item->item_name?></td>
                <td><?=$item->item_group_name?></td>
                <td align="right">Rp. <?=number_format($item->price, 2, "," , ".")?></td>
              </tr>             
              <?php 
                $subtotal += $item->price;
                $x++;
              }

            ?>
            </tbody>
            <tfoot>
              <tr>
                <td colspan="4"></td>
                <td>Subtotal</td>
                <td style="text-align: right">Rp. <?= number_format($subtotal, 2, "," , ".") ?></td>
              </tr>
            </tfoot>
            
          </table>          
        
        </div>
      
      
        <div class="child-panel-body-2">
        
          <div class="buttons-2" style="margin: 0 auto">
            <input type="button" value="Back" onclick="location.href='<?=base_url().'index.php/sell'?>'" />
          </div>
        </div>
        
      </div>
    </div>

  </div>
</div>